//
//  FeedBackController.m
//  easystudy
//
//  Created by kane on 15/6/4.
//  Copyright (c) 2015年 kane. All rights reserved.
//

#import "FeedBackController.h"

@interface FeedBackController ()<UITextViewDelegate>
{
    __weak IBOutlet UILabel *_noticeLabel;
    __weak IBOutlet UITextView *_txtView;
    
}

@end

@implementation FeedBackController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - User Actions

- (IBAction)backBtnPressed:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

- (IBAction)commitBtnPressed:(id)sender {
    [self.view endEditing:YES];
    if (_txtView.text.length > 500) {
        return;
    }
    NSDictionary *params = @{@"mobile":[UserEntity sharedUser].MobilePhone,
                             @"feed_type":@"0",
                             @"content":_txtView.text};
//    [WebService systemFeedback:params WithBlock:^(id result, NSError *error) {
//        if (!error) {
//            if ([result[@"result"] intValue] == 1) {
//                UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:result[@"message"] delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
//                [alert show];
//            }
//        }else{
//            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"网络连接失败,请检查网络" delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
//            [alert show];
//        }
//    }];
}

#pragma mark - UITextViewDelegate

- (void)textViewDidChange:(UITextView *)textView{
    _noticeLabel.hidden = textView.text.length == 0 ? NO : YES;
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [self.view endEditing:YES];
}


@end
